Repository navigation
fix: judge CC017 by the author passed to the author tools - #48
Merged
Merged
Conversation
commit-check 2.20 added CC017, which fails a commit whose author is an AI tool. For a message not yet committed it reads the author git would record, so through this server it judged the server's own git identity: validate_author_info never ran it, and validate_commit_context ignored the author_name/author_email it was given. Run CC017 with the passed author as GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL, inside the working-directory lock, and restore the environment after.
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #48 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 279 286 +7
=========================================
+ Hits 279 286 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
commit-check 2.20 added CC017: a commit whose author is an AI tool fails under
ai_attribution = "forbid"or"disclose". For a message not yet committed, the rule reads the author git would record. Through this server, that was the server's own git identity, not the author the agent passed in:validate_author_infonever ran CC017.validate_commit_contextran it on the server's identity and ignoredauthor_name/author_email.This change runs CC017 with the passed author (as
GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL, inside the existing working-directory lock, restored afterwards). With the default policy (ignore), CC017 doesn't exist, so nothing changes. On commit-check older than 2.20 it is a no-op.Before vs after
Server git identity
Alice <alice@example.com>, config{"commit": {"ai_attribution": "forbid"}}:validate_author_info(author_name="Claude", author_email="noreply@anthropic.com")pass: CC101 pass, CC102 pass (no CC017)fail: CC101 pass, CC102 pass, CC017 failvalidate_commit_context(message="feat: add caching", author_name="Claude", author_email="noreply@anthropic.com")pass: CC017 judgedAlice <alice@example.com>fail: CC017 judgedClaude <noreply@anthropic.com>validate_commit_messageand avalidate_commit_contextcall without an author still judge the pending author, the same as the CLI.Rest of the sync check against CLI v2.20.2 and main
Nothing else needed.
commit-check>=2.18.0,<3already resolves to 2.20.2 on Python 3.11+, and the message tools pick up CC013 to CC017 and the new detections on their own (MESSAGE_CHECKScomes from the CLI). The full suite passes against 2.19.5, 2.20.2 and CLI main (including the new output header, which the server doesn't print).--ai-attribution-onlyisn't exposed: nobody has asked for a PR-description tool.Tests
127 passed, 100% line coverage. The new CC017 tests skip on commit-check older than 2.20 (the Python 3.10 CI job still gets 2.19.5).